<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>简单功能演示网页</title>
</head>
<body>
    <!-- 功能1：点击弹窗 -->
    <button onclick="alert('你好！这是一个弹窗提示~')">点击我弹个窗</button>

    <hr>

    <!-- 功能2：简单加法计算 -->
    <h3>简单计算器</h3>
    数字1：<input type="number" id="num1">
    数字2：<input type="number" id="num2">
    <button onclick="calculate()">计算和</button>
    <p>结果：<span id="result"></span></p >

    <hr>

    <!-- 功能3：图片切换 -->
    <h3>图片切换</h3>
    < img id="myImage" src="https://picsum.photos/300/200?random=1" alt="示例图片">
    <button onclick="changeImage()">切换图片</button>

    <script>
        // 计算函数
        function calculate() {
            let num1 = document.getElementById("num1").value;
            let num2 = document.getElementById("num2").value;
            let sum = parseInt(num1) + parseInt(num2);
            document.getElementById("result").innerText = sum;
        }

        // 图片切换函数
        let imgIndex = 1;
        function changeImage() {
            imgIndex++;
            document.getElementById("myImage").src = `https://picsum.photos/300/200?random=${imgIndex}`;
        }
    </script>
</body>
</html>